package com.mind.core.net.client;

/*
 * ClientTest.java
 *
 * Created on __DATE__, __TIME__
 */

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

import com.mind.core.net.handler.HandlerManager;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
/**
 *
 * @author  __USER__
 */
public class UIClient extends javax.swing.JFrame {
	private SocketClient socketClient=null;
	private HandlerManager handlerManager;
	private WarningPanle warningPanle=null;
	/** Creates new form ClientTest */
	public UIClient(HandlerManager handlerManager) {
		initComponents();
		this.setVisible(true);
		this.handlerManager=handlerManager;
		warningPanle=new WarningPanle(this, true);
		warningPanle.setVisible(false);
		this.setLocationRelativeTo(null);
		this.setVisible(true);
	}

	//GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		jTextField1 = new javax.swing.JTextField();
		jScrollPane1 = new javax.swing.JScrollPane();
		jTextArea1 = new javax.swing.JTextArea();
		jButton3 = new javax.swing.JButton();
		getContentPane().add(jButton3, "North");
		jTextField2 = new javax.swing.JTextField();
		getContentPane().add(jTextField2, "South");
		getContentPane().add(jScrollPane1, "Center");
		getContentPane().add(jLabel1, "Center");
		getContentPane().add(jTextField1, "Center");
		jScrollPane1.setBounds(12, 46, 935, 540);
		jTextField2.setBounds(12, 606, 935, 27);

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		getContentPane().setLayout(null);

		jLabel1.setText("addr:");
		jLabel1.setBounds(24, 14, 38, 23);

		jTextField1.setText("192.168.1.110:8000");
		jTextField1.setBounds(74, 12, 172, 27);
		{
			jLabel3 = new JLabel();
			getContentPane().add(jLabel3, "Center");
			jLabel3.setText("user:");
			jLabel3.setBounds(264, 13, 49, 24);
		}
		{
			jTextField3 = new JTextField();
			getContentPane().add(jTextField3, "Center");
			jTextField3.setBounds(313, 13, 125, 27);
			jTextField3.setBackground(new java.awt.Color(255,255,255));
		}
		{
			jButton5 = new JButton();
			getContentPane().add(jButton5);
			jButton5.setText("login");
			jButton5.setBounds(969, 206, 88, 27);
			jButton5.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
					jButton5ActionPerformed(evt);
				}
			});
		}
		{
			jButton4 = new javax.swing.JButton();
			getContentPane().add(jButton4, "East");
			jButton4.setText("disconn");
			jButton4.setBounds(969, 350, 88, 27);
			jButton4.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent evt) {
					jButton4ActionPerformed(evt);
				}
			});
		}
		{
			jButton1 = new javax.swing.JButton();
			getContentPane().add(jButton1, "Center");
			jButton1.setText("connect");
			jButton1.setBounds(969, 141, 88, 27);
			jButton1.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent evt) {
					jButton1ActionPerformed(evt);
				}
			});
		}
		{
			jButton2 = new javax.swing.JButton();
			getContentPane().add(jButton2, "West");
			jButton2.setText("clear");
			jButton2.setBounds(969, 283, 88, 27);
			jButton2.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent evt) {
					jButton2ActionPerformed(evt);
				}
			});
		}
		{
			jLabel2 = new JLabel();
			jLabel2.setText("username:");
		}

		jTextArea1.setColumns(20);
		jTextArea1.setLineWrap(true);
		jTextArea1.setRows(5);
		jScrollPane1.setViewportView(jTextArea1);
		jTextArea1.setPreferredSize(new java.awt.Dimension(934, 535));
		jTextArea1.setFont(new Font(null, 0, 25));
		jButton3.setText("send");
		jButton3.setBounds(986, 606, 78, 27);
		jButton3.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton3ActionPerformed(evt);
			}
		});

		pack();
		this.setSize(1093, 695);
	}// </editor-fold>
	//GEN-END:initComponents

	private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
	}
	private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
//		socketClient.disConnect();
	}
	private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
		this.jTextArea1.setText("");
	}
	private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
		String addr = jTextField1.getText();
		String[] ip_port = addr.split(":");
//		socketClient=new Client(ip_port[0], Integer.parseInt(ip_port[1]), handlerManager);
	}
	private void jButton5ActionPerformed(ActionEvent evt) {
		
	}
	//GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JButton jButton1;
	private JButton jButton5;
	private JTextField jTextField3;
	private JLabel jLabel3;
	private JLabel jLabel2;
	private javax.swing.JButton jButton2;
	private javax.swing.JButton jButton3;
	private javax.swing.JButton jButton4;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JTextArea jTextArea1;
	private javax.swing.JTextField jTextField1;
	private javax.swing.JTextField jTextField2;
	// End of variables declaration//GEN-END:variables

}